import React, { useState } from 'react'
import { View } from '@tarojs/components'
import './index.scss'
const Space = (props) => {
  // direction ?: '' | 'vertical';
  const { direction = 'horizontal', style, classname, children } = props
  return <View style={style} className={`space_box ${direction === 'horizontal' ? 'space_horizontal' : 'space_vertical'} ${classname}`}>
    {children && children instanceof Array ? children.map((item, index) => {
      return <View className={direction === 'horizontal' ? 'space_horizontal_box' : 'space_vertical_box'} key={index}>{item}</View>
    }) : children}
  </View>
}

export default Space